package com.springbook.action;

import javax.servlet.ServletContext;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionServlet;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.springbook.*;

public class BaseAction extends Action {
	
	private RentABike store;

	public RentABike getStore() {
		return store;
	}

	public void setStore(RentABike store) {
		this.store = store;
	}
	
	public void setServlet(ActionServlet actionServlet) {
		super.setServlet(actionServlet);
		ServletContext servCont= actionServlet.getServletContext();
		WebApplicationContext wac= WebApplicationContextUtils.getWebApplicationContext(servCont);
		store=(RentABike) wac.getBean("rentaBike");
	}

}
